[#--
	分页
	page-page对象
	form-提交的表单id
	component-存储pageNo的隐藏域id
	showPage-最多显示的分页数
--]
[#macro page page form="mainForm" component="pageNo" showPage=7 ]
[#assign pageNo=page.getPageNo() /]
[#assign totalPages=page.totalPages /]
[#if totalPages==0]
	[#assign totalPages=1]
[/#if]
[#assign start=1 /]
[#assign end=totalPages /]
<span class="left">
每页${page.getPageSize()}条&nbsp;&nbsp;
[#--
找到${page.totalCount}条数据&nbsp;&nbsp;显示内容从${page.first}到${page.getPageSize()*pageNo}条
共${page.totalCount}条&nbsp;&nbsp;
--]
页码
<select id="select">
	[#list 1..totalPages as p]
		[#if pageNo==p]
			<option value="${p}" selected="selected">${p}</option>
		[#else]
			<option value="${p}">${p}</option>
		[/#if]
	[/#list]
</select>
</span>
<a href="javascript:void(0);" onclick="jump(1);">首页</a>
<a href="javascript:void(0);" onclick="jump(${page.prePage});">上一页</a>
[#if end>showPage]
	[#if pageNo>showPage]
		[#assign half=(showPage-showPage%2)/2]
		[#assign start=pageNo-half]
		[#assign end=pageNo+half]
	[#else]
		[#assign end=showPage]
	[/#if]
[/#if]
[#if end>totalPages]
	[#assign start=totalPages-showPage]
	[#assign end=totalPages]
[/#if]
[#list start..end as p]
	[#if pageNo==p]
		<a href="javascript:void(0);" onclick="jump(${p});" class="current">${p}</a>
	[#else]
		<a href="javascript:void(0);" onclick="jump(${p});">${p}</a>
	[/#if]
[/#list]
<a href="javascript:void(0);" onclick="jump(${page.nextPage});">下一页</a>
<a href="javascript:void(0);" onclick="jump(${page.totalPages});">尾页</a>
<script type="text/javascript">
function jump(pageNo){
	$('#${component}').val(pageNo);
	$('#${form}').submit();
}
$(document).keydown(function(event){
	//首页33;尾页34;上一页37;下一页39;
	switch(event.keyCode){
		case 33:
			jump(1);
			break;
		case 34:
			jump(${page.totalPages});
			break;
		case 37:
			jump(${page.prePage});
			break;
		case 39:
			jump(${page.nextPage});
			break;
		default:
	}
});
$('#select').change(function(){
	$('#${component}').val($(this).val());
	$('#${form}').submit();
});
</script>
[/#macro]